/**********************************************************************************
* CLASS
*		BookMovie
*
* DESCRIPTION
*		Book Multimedia support all of the music and movie.
* 		Multimedia manipulate function set:
*			- setSize
*			- setAutoPlay
*			- setDisplay
*		Common function set:
*			- genDomObj   (Use by Genesis for create multimedia by using dom.)
*			- loadDefault (For loading default value.)
*
* REVISION HISTORY
*		Revision 1.0 2008/09/10 Atthaboon S.
*		First Release
*
**********************************************************************************/
var BookMovie = Class.create({

	/****************************************************
	* FUNCTION
	*		initialize
	*
	* DESCRIPTION
	* 		initialize the Genesis object.
	*
	* ARGUMENTS
	*		src					: 	Multimedia source
	*		position_x		   	:	Multimedia position of x at north left Genesis corner.
	*		position_y 	   	   	:	Multimedia position of y at north left Genesis corner.
	*
	****************************************************/
  	initialize: function(src,position_x,position_y)
  	{
  		this.domObj = new Element('embed', { 'src':src,'style':'position:absolute; left:'+position_x+'px;top:'+position_y+'px;'});
  		$(this.domObj).setAttribute('width','280px');
  		$(this.domObj).setAttribute('height','200px');
  		$(this.domObj).setAttribute('autoplay','false');
  	},
  	
  	/****************************************************
	* FUNCTION 
	*		getDomObj
	*
	* DESCRIPTION
	* 		Use by Genesis for get dom Object.
	*
	* ARGUMENTS
	*
	****************************************************/
	getDomObj : function()
	{
		return this.domObj;
	},
	
	/****************************************************
	* FUNCTION 
	*		setPosition
	*
	* DESCRIPTION
	* 		Set position.
	*
	* ARGUMENTS
	*		position_x		   	:	position x in px.
	*		position_y 	   	   	:	position y in px.
	*
	****************************************************/
	setPosition : function(position_x,position_y)
	{	
		$(this.domObj).setStyle({
		  	left: position_x+'px',
		  	top: position_y+'px'
		});
	},
	
	/****************************************************
	* FUNCTION 
	*		setSize
	*
	* DESCRIPTION
	* 		Set size.
	*
	* ARGUMENTS
	*		width		   	:	width in px.
	*		height 	   	   	:	height in px.
	*
	****************************************************/
	setSize : function(width,height)
	{	
		$(this.domObj).setStyle({
		  	width: width+'px',
		  	height: height+'px'
		});
	},
	
	/****************************************************
	* FUNCTION 
	*		setDisplay
	*
	* DESCRIPTION
	* 		Set Display or hidden.
	*
	* ARGUMENTS
	*		display		   		:	true  if display
	*							:	false if hidden
	*
	****************************************************/
	setDisplay : function(display)
	{	
		$(this.domObj).setAttribute('hidden',display);
	},
	
	/****************************************************
	* FUNCTION 
	*		setAutoPlay
	*
	* DESCRIPTION
	* 		Set Auto play when load page.
	*
	* ARGUMENTS
	*		autoplay		   	:	true  if auto play when load page
	*							:	false if not auto play when load page
	*
	****************************************************/
	setAutoPlay : function(loop)
	{	
		$(this.domObj).setAttribute('autoplay',loop);
	}
});